<?php
function order_list($files,$order,$currentPath=''){
	$matirx = array();
	 
	if(!$order){
		return $files;
	}

	$order_time = array();
	$order_size = array();
	$orderName = array();
	for($i=0;$i<count($files);$i++){
		$file = $files[$i];
		$path = $file;
		if($currentPath){
			$path = $currentPath.$file;
		}
		if($order == 1){
			$order_time[] = filemtime($path);
		}else if($order == 2){
			$order_size[] = filesize($path);
		}else if($order == 3){
			$base_name = get_base_name($path);
			$file_name = to_php_encoding($base_name) ;
			array_push($orderName, $file_name);
		}
		 
		array_push($matirx, $file);
	}

	if($order == 1){
		array_multisort($order_time,SORT_DESC,SORT_STRING, $matirx);
	}else if($order == 2){
		array_multisort($order_size,SORT_DESC,SORT_NUMERIC, $matirx);
	}else if($order == 3){
		array_multisort($orderName,SORT_DESC,SORT_STRING, $matirx);
	}
		
	return $matirx;
}

print "<a href='#' class='iconlink' onclick='createNewFolder()'>新建目录</a>";
print "<a href='#' class='iconlink' onclick='do_refresh()'>刷新</a>";
print "<div style='float:right;margin-right:22px;'><span>浏览方式：</span>";
print make_radio('read_type', array('1'=>'列表','2'=>'图片'),deep_get('view_type',0,1),array('onclick'=>'get_read_type(this)'));
print "<span style='margin-left:50px;'>排序:	".make_select('orderList', array('1'=>'时间','2'=>'大小','3'=>'名称'),deep_get('order',0,1),0,'',array('onchange'=>'orderList(this)'))."</span></div>";
 
?>